package com.lyx.list;

import com.lyx.list.TestAbstractList;
import com.lyx.list.TestList;

public class TestLinkedList<E> extends TestAbstractList<E> implements TestList<E> {

    transient int size = 0;

    transient Node<E> first;

    transient Node<E> last;

    public TestLinkedList() {
    }


    @Override
    public boolean add(E e) {
        return false;
    }

    @Override
    public E get(int index) {
        return null;
    }

    void linkLast(E e){
        final Node<E> l = last;
        final Node<E> newNode = new Node<>(l,e,null);
        last = newNode;
        if(l == null){
            first = newNode;
        }else {
            l.next = newNode;
        }
        size++;
        modCount++;
    }





    private static class Node<E>{
        E item;
        Node<E> next;
        Node<E> prev;

        public Node(Node<E> prev,E item, Node<E> next) {
            this.item = item;
            this.next = next;
            this.prev = prev;
        }
    }
}
